// 个人信用查询
apiready = function(){
		//绑定事件
      	$api.addEvt($api.byId('queryScore'), 'click', queryScore);
      	$api.addEvt($api.byId('showCredit'), 'click', showCredit);
}
// 车贷评分查询
 function queryScore(){
    var   mobile = $api.byId("mobile").value.trim();

    if( !_CheckSinglePhone(mobile))         {
    	alert("输入有误！");
    } else{
      // 提交JSON数据
      api.ajax({
        url: 'http://'+sourceIp+':20099/scoreInfo/select?m='+mobile,
        method: 'get',
        headers: {
          'Content-Type': 'application/json;charset=utf-8'
        }
      }, function(ret, err) {
        if (ret) {
          $api.addCls($api.byId("score"), 'view');
          if(ret.data[0])  {
            $api.html($api.byId("score"), ret.data[0].score+"分");
          }else{
            $api.html($api.byId("score"),"无记录");
          }
        } else {
          api.alert({ msg: JSON.stringify(err) });
        }
      });
    }
}
// 打开评分页面
function showCredit(){
	var   mobile = $api.byId("mobile").value.trim();
	if(!_CheckSinglePhone(mobile))         {
	alert("输入有误！");
} else{
  	api.openWin({
	    name: 'creditScore',
	    url: '../creditScore/creditScore.html',
	    pageParam: {
	        mobile: mobile
	    }
	});
	}
}
